package com.weiyi.chat.presenter;

import com.weiyi.chat.api.IComeBackPsw;
import com.weiyi.chat.api.IResetPsw;
import com.weiyi.chat.common.MyStringCallBack;
import com.weiyi.chat.ui.activity.ComeBackPswActivity;
import com.weiyi.chat.ui.activity.ResetPswActivity;
import com.weiyi.chat.utils.MyReusouce;
import com.zhy.http.okhttp.OkHttpUtils;

/**
 * Created by Lee on 2017/8/24 0024.
 */

public class ComeBackPswPresenter implements IComeBackPsw.presenter {


    private ComeBackPswActivity mView;

    public ComeBackPswPresenter(ComeBackPswActivity comeBackPswActivity) {
        mView = comeBackPswActivity;
    }

    @Override
    public void requsetResetPsw(String account, String new_psw, String real_name, String id_number) {
        OkHttpUtils.post()
                .url(MyReusouce.COME_BACK_PSW_URL)
                .addParams("account", account)
                .addParams("owner", real_name)
                .addParams("id_number", id_number)
                .addParams("newpass", new_psw)
                .build()
                .execute(new MyStringCallBack(mView) {
                    @Override
                    public void onRequestSucess(String response) {
                        mView.onResetSucess();
                    }

                    @Override
                    public void onRequstFail(String errorInfo) {
                        mView.showError(errorInfo);
                    }
                });
    }

    @Override
    public void loadingDatasFromCache() {

    }
}
